import axios from "axios";

export const AuthResponseInterceptor = (err: any) => {
  if (err.response?.status === 401) {
    if (sessionStorage.getItem("GeminisLoginUrl")) {
      window.location.href = sessionStorage.getItem("GeminisLoginUrl");// + '?return=' + encodeURI(window.location.href);
    }
  }
  return Promise.reject(err);
};

export const enableAuthResponseInterceptor = () => {
  axios.interceptors.response.use(null, AuthResponseInterceptor);
}
